-- prop
-- created by zhuangsl
-- 直接使用整个prop的状态
-- condition中直接传入prop，需要key、value可以直接替换进描述

return {
    fetchProps = function(who, status, condition)
        local props  = {};
        local propId = PropM.getPropId("attrib");
        local endRound = condition["end_round"];
        
        local attack  = tonumber(condition["attack"]);
        if attack > 0 then
            table.insert(props, { propId, "attack", attack, endRound, });
        end
        
        local magic = tonumber(condition["magic"]);
        if magic > 0 then
            table.insert(props, { propId, "magic", magic, endRound, });
        end
        
        local magic_effect = tonumber(condition["magic_effect"]);
        if magic_effect > 0 then
            propId = PropM.getPropId("magic_effect_style");
            table.insert(props, { propId, "all", magic_effect, endRound, });
        end

        return props;
    end,

    desc = function(who, status, condition)
        -- 获取状态描述
        local cfg = CombatStatusM.getStatusInfo(status);
        local desc = cfg.desc;

        -- 天赋额外效果
        local magic_effect  = tonumber(condition["magic_effect"]);
        if magic_effect > 0 then
            desc = cfg.extra_desc;
            magic_effect = math.modf(magic_effect / 10);
            desc = string.gsub(desc, "{rate}", magic_effect);
        end

        -- 显示为百分比
        local attack  = tonumber(condition["attack"]);
        attack = math.modf(attack / 10);
        desc = string.gsub(desc, "{value}", attack);
        
        local magic  = tonumber(condition["magic"]);
        local attrib = FieldsM.getFieldName("attack")
        if magic > 0 then
            attrib = attrib .. getLocStr("and2") .. FieldsM.getFieldName("magic");
        end
        desc = string.gsub(desc, "{attrib}", attrib);
        
        return desc;
    end,
};
